package com.tyut.musicdreamer.service.gateway.config;

import cn.dev33.satoken.context.SaTokenContext;
import cn.dev33.satoken.reactor.spring.SaTokenContextForSpringReactor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;

/**
 * Sa-Token响应式上下文配置
 * 确保在Spring Cloud Gateway环境中正确初始化Sa-Token上下文
 */
@Configuration
public class SaTokenContextConfig {
    
    /**
     * 注册Sa-Token上下文处理器，并设置高优先级
     */
    @Bean
    @Primary
    @Order(1)
    public SaTokenContext saTokenContext() {
        return new SaTokenContextForSpringReactor();
    }
} 